package com.xzakota.minesweeper.ui.dialog.templae;

import com.xzakota.minesweeper.widget.text.InputTextField;

import javax.swing.*;
import java.awt.*;

/**
 * 输入对话框
 *
 * @author Xzakota
 */
public class InputDialog extends AbstractBaseDialog {
    private final InputTextField textField;

    public InputDialog() {
        this(null);
    }

    public InputDialog(Window parent) {
        this(parent, true);
    }

    public InputDialog(Window parent, boolean isModal) {
        super(parent);

        setTitle("请输入");

        JPanel mainPanel = new JPanel();
        mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));

        textField = new InputTextField();
        mainPanel.add(textField);

        setComponent(mainPanel);

        style3Buttons();
    }

    public void setFieldText(String text) {
        textField.setFieldText(text);
    }
    public String getFieldText() {
        return textField.getFieldText();
    }

    public void setTagText(String text) {
        textField.setTagText(text);
    }

    public void setHintText(String text) {
        textField.setHintText(text);
    }

    public void setHintText(String text, Color color) {
        textField.setHintText(text, color);
    }

    @Override
    public void requestFocus() {
        textField.requestFocus();
    }
}
